import request from '@/utils/request.js'

// 获取商品列表 分页查询
export const getGoodsListService = (params) => {
    return request.get('/goods/list', {params: params})
}

// 添加商品
export const addGoodsService = (data) => {
    return request.post('/goods/add', data)
}

// 修改商品
export const updateGoodsService = (data) => {
    return request.put('/goods/update', data)
}

// 删除商品
export const deleteGoodsService = (id) => {
    return request.delete(`/goods/delete/${id}`)
}

// 获取库存小于10的商品
export const getGoodsStockService = (params) => {
    return request.get('/goods/stock', {params: params})
}

// 获取临期商品
export const getGoodsExpireService = (data) => {
    return request.get('/goods/overdue', data)
}

// 获取临期商品列表（分页）
export const getGoodsExpireListService = (params) => {
    return request.get('/goods/expire', { params })
}

// 批量删除商品
export const batchDeleteGoodsService = (data) => {
    return request.delete('/goods/batchDelete', {data: data})
}

// 获取商品列表
export const getListService = () => {
    return request.get('/goods/all')
}